package com.example.springbootexperiment02.custom;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;


@Component
@Slf4j
public class NoticeLi implements ApplicationListener<EventNotice> {

    @Override
    public void onApplicationEvent(EventNotice Eventnotice) {

        log.info("事件监听器获取到 NoticeEvent,睡眠当前线程2秒..");

        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        log.info(" NoticeEvent的 message属性是：{}",eventNotice.getMessage());

    }
}